/*     */ package com.lmpop.trade.ti_onlinegroup;
/*     */ 
/*     */ import com.lmpop.frame.QueryList;
/*     */ import com.lmpop.frame.SysMap;
/*     */ import com.lmpop.frame.TradeInterf;
/*     */ import com.lmpop.frame.dao.DbmInterf;
/*     */ import com.lmpop.frame.exp.ApplicationException;
/*     */ import com.lmpop.frame.util.RandomID;
/*     */ import java.util.Hashtable;
/*     */ import java.util.List;
/*     */ 
/*     */ public class Ti_onlinegroupInfo
/*     */   implements TradeInterf
/*     */ {
/*     */   QueryList queryList;
/*     */ 
/*     */   public Ti_onlinegroupInfo()
/*     */   {
/*  17 */     this.queryList = new QueryList();
/*     */   }
/*     */ 
/*     */   public SysMap insert(DbmInterf dbmMgr, SysMap map)
/*     */   {
/*  26 */     Ti_onlinegroup ti_onlinegroup = new Ti_onlinegroup();
/*  27 */     RandomID random = new RandomID();
/*  28 */     ti_onlinegroup.setGroup_id(random.GenTradeId());
/*  29 */     ti_onlinegroup.setGroup_name(map.getString("group_name"));
/*  30 */     ti_onlinegroup.setGroup_type(map.getString("group_type"));
/*  31 */     ti_onlinegroup.setRemark(map.getString("remark"));
/*  32 */     ti_onlinegroup.setOperator_id(map.getString("operator_id"));
/*  33 */     String result_code = "0";
/*     */     try {
/*  35 */       insert(dbmMgr, ti_onlinegroup);
/*     */     } catch (ApplicationException e) {
/*  37 */       e.printStackTrace();
/*  38 */       result_code = "1";
/*     */     }
/*  40 */     map.setString("result_code", result_code);
/*  41 */     return map;
/*     */   }
/*     */ 
/*     */   public void insert(DbmInterf dbmMgr, Ti_onlinegroup ti_onlinegroup)
/*     */     throws ApplicationException
/*     */   {
/*  50 */     dbmMgr.update("insertTi_onlinegroup", ti_onlinegroup);
/*     */   }
/*     */ 
/*     */   public SysMap delete(DbmInterf dbmMgr, SysMap map)
/*     */   {
/*  60 */     String pkid_string = map.getString("pkid");
/*  61 */     String result_code = "0";
/*     */     try {
/*  63 */       if (!pkid_string.equals("")) {
/*  64 */         String[] pkStr = pkid_string.split("\\|");
/*  65 */         for (int i = 0; i < pkStr.length; i++) {
/*  66 */           if (pkStr[i].equals("")) continue; delete(dbmMgr, pkStr[i]);
/*     */         }
/*     */       }
/*     */     } catch (ApplicationException e) {
/*  70 */       e.printStackTrace();
/*  71 */       result_code = "1";
/*     */     }
/*  73 */     map.setString("result_code", result_code);
/*  74 */     return map;
/*     */   }
/*     */ 
/*     */   public void delete(DbmInterf dbmMgr, String pkid)
/*     */     throws ApplicationException
/*     */   {
/*  83 */     dbmMgr.update("deleteTi_onlinegroup", pkid);
/*     */   }
/*     */ 
/*     */   public SysMap update(DbmInterf dbmMgr, SysMap map)
/*     */   {
/*  92 */     Ti_onlinegroup ti_onlinegroup = new Ti_onlinegroup();
/*  93 */     ti_onlinegroup.setGroup_id(map.getString("group_id"));
/*  94 */     ti_onlinegroup.setGroup_name(map.getString("group_name"));
/*  95 */     ti_onlinegroup.setGroup_type(map.getString("group_type"));
/*  96 */     ti_onlinegroup.setRemark(map.getString("remark"));
/*  97 */     ti_onlinegroup.setEnabled(map.getString("enabled"));
/*  98 */     ti_onlinegroup.setOperator_id(map.getString("operator_id"));
/*  99 */     String result_code = "0";
/*     */     try {
/* 101 */       update(dbmMgr, ti_onlinegroup);
/*     */     } catch (ApplicationException e) {
/* 103 */       e.printStackTrace();
/* 104 */       result_code = "1";
/*     */     }
/* 106 */     map.setString("result_code", result_code);
/* 107 */     return map;
/*     */   }
/*     */ 
/*     */   public void update(DbmInterf dbmMgr, Ti_onlinegroup ti_onlinegroup)
/*     */     throws ApplicationException
/*     */   {
/* 116 */     dbmMgr.update("updateTi_onlinegroup", ti_onlinegroup);
/*     */   }
/*     */ 
/*     */   public List getListByPage(Object obj, int start, int limit)
/*     */   {
/* 126 */     Hashtable ti_onlinegroup = (Hashtable)obj;
/* 127 */     if (start == 0)
/* 128 */       start = 0;
/*     */     else {
/* 130 */       start = (start - 1) * limit;
/*     */     }
/* 132 */     ti_onlinegroup.put("start", Integer.valueOf(start));
/* 133 */     ti_onlinegroup.put("limit", Integer.valueOf(limit));
/* 134 */     return this.queryList.getList("getListByTi_onlinegroupPage", ti_onlinegroup);
/*     */   }
/*     */ 
/*     */   public int getCountByObj(Object obj)
/*     */   {
/* 145 */     Hashtable ti_onlinegroup = (Hashtable)obj;
/* 146 */     List list = this.queryList.getList("getCountByObjTi_onlinegroup", ti_onlinegroup);
/* 147 */     int count = 0;
/* 148 */     if ((list != null) && (list.size() > 0)) {
/* 149 */       Hashtable newsMap = (Hashtable)list.get(0);
/* 150 */       if ((newsMap.get("count") != null) && (!newsMap.get("count").toString().equals(""))) {
/* 151 */         count = Integer.parseInt(newsMap.get("count").toString());
/*     */       }
/*     */     }
/* 154 */     return count;
/*     */   }
/*     */ 
/*     */   public List getListByPk(String pk)
/*     */   {
/* 164 */     return this.queryList.getList("getTi_onlinegroupByPk", pk);
/*     */   }
/*     */ 
/*     */   public String getSelectItem(String group_id)
/*     */   {
/* 169 */     String selectItems = "";
/* 170 */     List list = this.queryList.getList("getSelectItemByGroupID");
/* 171 */     Hashtable objMap = new Hashtable();
/* 172 */     String sKey = "";
/* 173 */     String sValue = "";
/* 174 */     if ((list != null) && (list.size() > 0)) {
/* 175 */       for (int i = 0; i < list.size(); i++) {
/* 176 */         objMap = (Hashtable)list.get(i);
/* 177 */         if (objMap.get("group_id") != null) {
/* 178 */           sKey = objMap.get("group_id").toString();
/*     */         }
/* 180 */         if (objMap.get("group_name") != null) {
/* 181 */           sValue = objMap.get("group_name").toString();
/*     */         }
/* 183 */         if (group_id.equals(sKey))
/* 184 */           selectItems = selectItems + "<option selected value=" + sKey + ">" + sValue + "</option>";
/*     */         else {
/* 186 */           selectItems = selectItems + "<option value=" + sKey + ">" + sValue + "</option>";
/*     */         }
/*     */       }
/*     */     }
/* 190 */     return selectItems;
/*     */   }
/*     */ }

/* Location:           F:\电商\commons-utils.jar
 * Qualified Name:     com.lmpop.trade.ti_onlinegroup.Ti_onlinegroupInfo
 * JD-Core Version:    0.6.0
 */